Skip to content

WIP: Add typography performance tests#8918

Open
shakeelmohamed wants to merge 3 commits into
processing:mainfrom
shakeelmohamed:bench-typography
Open

WIP: Add typography performance tests#8918
shakeelmohamed wants to merge 3 commits into
processing:mainfrom
shakeelmohamed:bench-typography

Conversation

@shakeelmohamed

@shakeelmohamed shakeelmohamed commented Jun 15, 2026

Copy link
Copy Markdown

Add initial performance benchmark tests and structure for typography tests.

PR Checklist

  • npm run lint passes
  • Document manual v1 to v2 test code via CLI
  • Create issues for remaining test cases

@ksen0 ksen0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work here! Comments below based on going through this PR with @limzykenneth .

The priority, especially if full completion is out of rant scope, is to complete the harness. If not possible to complete all the functions, these can be left open to community implementation in a new issue.

If possible, in addition to the minimal performance testing doc, it would be great to add instructions + example code for running manually (via CLI not the editor) a comparison between v1 and v2. As discussed, there is no equivalent quite for v1, but enabling comparison between v1 and v2 (even if manual / documentation primarily) would be ideall

@@ -0,0 +1,65 @@
# Typography Benchmarks

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for including the WIP! In general the results do not need to be checked in. The documentation part can be put into a contributor doc on performance testing. (eg, here is the doc on unit testing, which is then included on the website)


Implementation notes:

- All pre-existing benchmarks included the full p5 instance setup which adds ~50ms to each test. The `textToPoints() single word, isolated benchmark` test is included as a potential way to isolate performance testing away from setup overhead.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here: con be added to a new contributor doc on performance testing. That can be very short, so not necessary to add more than what you have here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ksen0 added, please review!

Comment thread test/bench/typography.bench.js
Comment thread test/bench/typography.bench.js Outdated
options
);

// TODO: This is an example of using setup() to isolate benchmarks away from p5 instance setup code

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible to do everywhere? (Alternatively to upping iterations)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think even if we up the iterations, we'd be including the time it takes to create a canvas and parse the font, so ideally we'd go with this solution everywhere and move the setup out into its own thing

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ksen0 @davepagurek Great, I’ve also parameterized the textToPoints() tests so they don’t drift over time or across the 3 renderers. The alternative is a lot of error-prone copy-paste test writing 😄

Comment thread test/bench/typography.bench.js Outdated
options
);

// TODO: textToContours()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these are out of scope, rather than leaving them as inline todo's, you could make an open issue.

@shakeelmohamed shakeelmohamed marked this pull request as ready for review June 29, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants